namespace WebApiExample.Data.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;
    using WebApiExample.Model;

    internal sealed class Configuration : DbMigrationsConfiguration<WebApiExample.Data.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false;
        }

        protected override void Seed(WebApiExample.Data.ApplicationDbContext context)
        {
            context.Pets.AddOrUpdate(p => p.Name,
                new Pet { Name = "Rex", Age = 7, Type = "Dog", IsYoung = false },
                new Pet { Name = "Max", Age = 40, Type = "Dino", IsYoung = true },
                new Pet { Name = "Sally", Age = 3, Type = "Parrot", IsYoung = true },
                new Pet { Name = "Mittens", Age = 1, Type = "Kitten", IsYoung = true }
                );
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
    }
}
